import common.CommonDemo;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

import java.time.Duration;

public class WindowMaximize {

    CommonDemo commonDemo = new CommonDemo();
    private ChromeDriver driver;
    private String webUrl;
    private String url = "src/main/resources/Alerts.html";
    private WebDriverWait wait;

    @BeforeTest
    public void setUp() throws Exception{
        //获取chromedriver
        driver = commonDemo.getChromeDriver();
        wait = new WebDriverWait(driver, Duration.ofSeconds(2));
    }

    //file:///D:/springDemo/SeleniumLearn/src/main/resources/Alerts.html
    @Test
    public void test() throws Exception{
        String filepath = commonDemo.getUserDir(url);
        driver.get(filepath);
        driver.manage().window().maximize();
    }

    @AfterClass
    public void tearDown() throws Exception{
        Thread.sleep(2000);
        driver.quit();
    }
}
